package com.glsc.ngateway.common.base.domain.mysql.cmdb;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Data
@Entity
@Table(name = "t_cmdb_cpu_standard_device_standard_relate")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CmdbCpuStandardDeviceStandardRelate {

    @Column(name = "device_standard_code", length = 100, columnDefinition = "varchar(100) DEFAULT NULL COMMENT '设备规格id'")
    private String deviceStandardCode;

    @Column(name = "cpu_standard_code", length = 100, columnDefinition = "varchar(100) DEFAULT NULL COMMENT 'cpu规格id'")
    private String cpuStandardCode;

    @Column(columnDefinition = "int DEFAULT NULL COMMENT '数量'")
    private Integer amount;

    @OneToOne
    @JoinColumn(name = "cpu_standard_code", referencedColumnName = "cpu_standard_code",foreignKey = @ForeignKey(name = "none",value = ConstraintMode.NO_CONSTRAINT),insertable = false, updatable = false)
    private CmdbCpuStandard cmdbCpuStandard;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Builder.Default
    @Column(name = "is_delete", nullable = true, columnDefinition = "int DEFAULT '0' COMMENT '是否删除，0未删除，1 已删除'")
    private Integer isDelete = 0;

    // Getters and Setters

}

